import { request } from '@/utils/request';
import { RequestEnum } from '@/enums/httpEnum';

export const rusticAdminApi = {
  rusticAdminList: '/rusticAdmin/list',
  rusticAdminDetail: '/rustic/admin/detail',
  rusticAdminAdd: '/rustic/admin/add',
  rusticAdminUpdate: '/rustic/admin/update',
  rusticAdminDelete: '/rusticAdmin/delete',
} as const;

export const createRusticAdmin = (data: API.CreateRusticAdminParams) => {
  return request({
    url: rusticAdminApi.rusticAdminAdd,
    method: RequestEnum.POST,
    data,
  });
};

export const updateRusticAdmin = (data: API.UpdateRusticAdminParams) => {
  return request({
    url: rusticAdminApi.rusticAdminUpdate,
    method: RequestEnum.POST,
    data,
  });
};

export const deleteRusticAdmin = (params: { adminId: number; rusticId: number }) => {
  return request({
    url: rusticAdminApi.rusticAdminDelete,
    method: RequestEnum.DELETE,
    params,
  });
};
